|
1
|
|
|
/* |
|
2
|
|
|
* JavaScript Load Image Exif Map |
|
3
|
|
|
* https://github.com/blueimp/JavaScript-Load-Image |
|
4
|
|
|
* |
|
5
|
|
|
* Copyright 2013, Sebastian Tschan |
|
6
|
|
|
* https://blueimp.net |
|
7
|
|
|
* |
|
8
|
|
|
* Exif tags mapping based on |
|
9
|
|
|
* https://github.com/jseidelin/exif-js |
|
10
|
|
|
* |
|
11
|
|
|
* Licensed under the MIT license: |
|
12
|
|
|
* https://opensource.org/licenses/MIT |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
/* global define */ |
|
16
|
|
|
|
|
17
|
|
|
;(function (factory) { |
|
18
|
|
|
'use strict' |
|
19
|
|
|
if (typeof define === 'function' && define.amd) { |
|
20
|
|
|
// Register as an anonymous AMD module: |
|
21
|
|
|
define(['./load-image', './load-image-exif'], factory) |
|
22
|
|
|
} else if (typeof module === 'object' && module.exports) { |
|
23
|
|
|
factory(require('./load-image'), require('./load-image-exif')) |
|
24
|
|
|
} else { |
|
25
|
|
|
// Browser globals: |
|
26
|
|
|
factory(window.loadImage) |
|
27
|
|
|
} |
|
28
|
|
View Code Duplication |
})(function (loadImage) { |
|
29
|
|
|
'use strict' |
|
30
|
|
|
|
|
31
|
|
|
loadImage.ExifMap.prototype.tags = { |
|
32
|
|
|
// ================= |
|
33
|
|
|
// TIFF tags (IFD0): |
|
34
|
|
|
// ================= |
|
35
|
|
|
0x0100: 'ImageWidth', |
|
36
|
|
|
0x0101: 'ImageHeight', |
|
37
|
|
|
0x8769: 'ExifIFDPointer', |
|
38
|
|
|
0x8825: 'GPSInfoIFDPointer', |
|
39
|
|
|
0xa005: 'InteroperabilityIFDPointer', |
|
40
|
|
|
0x0102: 'BitsPerSample', |
|
41
|
|
|
0x0103: 'Compression', |
|
42
|
|
|
0x0106: 'PhotometricInterpretation', |
|
43
|
|
|
0x0112: 'Orientation', |
|
44
|
|
|
0x0115: 'SamplesPerPixel', |
|
45
|
|
|
0x011c: 'PlanarConfiguration', |
|
46
|
|
|
0x0212: 'YCbCrSubSampling', |
|
47
|
|
|
0x0213: 'YCbCrPositioning', |
|
48
|
|
|
0x011a: 'XResolution', |
|
49
|
|
|
0x011b: 'YResolution', |
|
50
|
|
|
0x0128: 'ResolutionUnit', |
|
51
|
|
|
0x0111: 'StripOffsets', |
|
52
|
|
|
0x0116: 'RowsPerStrip', |
|
53
|
|
|
0x0117: 'StripByteCounts', |
|
54
|
|
|
0x0201: 'JPEGInterchangeFormat', |
|
55
|
|
|
0x0202: 'JPEGInterchangeFormatLength', |
|
56
|
|
|
0x012d: 'TransferFunction', |
|
57
|
|
|
0x013e: 'WhitePoint', |
|
58
|
|
|
0x013f: 'PrimaryChromaticities', |
|
59
|
|
|
0x0211: 'YCbCrCoefficients', |
|
60
|
|
|
0x0214: 'ReferenceBlackWhite', |
|
61
|
|
|
0x0132: 'DateTime', |
|
62
|
|
|
0x010e: 'ImageDescription', |
|
63
|
|
|
0x010f: 'Make', |
|
64
|
|
|
0x0110: 'Model', |
|
65
|
|
|
0x0131: 'Software', |
|
66
|
|
|
0x013b: 'Artist', |
|
67
|
|
|
0x8298: 'Copyright', |
|
68
|
|
|
// ================== |
|
69
|
|
|
// Exif Sub IFD tags: |
|
70
|
|
|
// ================== |
|
71
|
|
|
0x9000: 'ExifVersion', // EXIF version |
|
72
|
|
|
0xa000: 'FlashpixVersion', // Flashpix format version |
|
73
|
|
|
0xa001: 'ColorSpace', // Color space information tag |
|
74
|
|
|
0xa002: 'PixelXDimension', // Valid width of meaningful image |
|
75
|
|
|
0xa003: 'PixelYDimension', // Valid height of meaningful image |
|
76
|
|
|
0xa500: 'Gamma', |
|
77
|
|
|
0x9101: 'ComponentsConfiguration', // Information about channels |
|
78
|
|
|
0x9102: 'CompressedBitsPerPixel', // Compressed bits per pixel |
|
79
|
|
|
0x927c: 'MakerNote', // Any desired information written by the manufacturer |
|
80
|
|
|
0x9286: 'UserComment', // Comments by user |
|
81
|
|
|
0xa004: 'RelatedSoundFile', // Name of related sound file |
|
82
|
|
|
0x9003: 'DateTimeOriginal', // Date and time when the original image was generated |
|
83
|
|
|
0x9004: 'DateTimeDigitized', // Date and time when the image was stored digitally |
|
84
|
|
|
0x9290: 'SubSecTime', // Fractions of seconds for DateTime |
|
85
|
|
|
0x9291: 'SubSecTimeOriginal', // Fractions of seconds for DateTimeOriginal |
|
86
|
|
|
0x9292: 'SubSecTimeDigitized', // Fractions of seconds for DateTimeDigitized |
|
87
|
|
|
0x829a: 'ExposureTime', // Exposure time (in seconds) |
|
88
|
|
|
0x829d: 'FNumber', |
|
89
|
|
|
0x8822: 'ExposureProgram', // Exposure program |
|
90
|
|
|
0x8824: 'SpectralSensitivity', // Spectral sensitivity |
|
91
|
|
|
0x8827: 'PhotographicSensitivity', // EXIF 2.3, ISOSpeedRatings in EXIF 2.2 |
|
92
|
|
|
0x8828: 'OECF', // Optoelectric conversion factor |
|
93
|
|
|
0x8830: 'SensitivityType', |
|
94
|
|
|
0x8831: 'StandardOutputSensitivity', |
|
95
|
|
|
0x8832: 'RecommendedExposureIndex', |
|
96
|
|
|
0x8833: 'ISOSpeed', |
|
97
|
|
|
0x8834: 'ISOSpeedLatitudeyyy', |
|
98
|
|
|
0x8835: 'ISOSpeedLatitudezzz', |
|
99
|
|
|
0x9201: 'ShutterSpeedValue', // Shutter speed |
|
100
|
|
|
0x9202: 'ApertureValue', // Lens aperture |
|
101
|
|
|
0x9203: 'BrightnessValue', // Value of brightness |
|
102
|
|
|
0x9204: 'ExposureBias', // Exposure bias |
|
103
|
|
|
0x9205: 'MaxApertureValue', // Smallest F number of lens |
|
104
|
|
|
0x9206: 'SubjectDistance', // Distance to subject in meters |
|
105
|
|
|
0x9207: 'MeteringMode', // Metering mode |
|
106
|
|
|
0x9208: 'LightSource', // Kind of light source |
|
107
|
|
|
0x9209: 'Flash', // Flash status |
|
108
|
|
|
0x9214: 'SubjectArea', // Location and area of main subject |
|
109
|
|
|
0x920a: 'FocalLength', // Focal length of the lens in mm |
|
110
|
|
|
0xa20b: 'FlashEnergy', // Strobe energy in BCPS |
|
111
|
|
|
0xa20c: 'SpatialFrequencyResponse', |
|
112
|
|
|
0xa20e: 'FocalPlaneXResolution', // Number of pixels in width direction per FPRUnit |
|
113
|
|
|
0xa20f: 'FocalPlaneYResolution', // Number of pixels in height direction per FPRUnit |
|
114
|
|
|
0xa210: 'FocalPlaneResolutionUnit', // Unit for measuring the focal plane resolution |
|
115
|
|
|
0xa214: 'SubjectLocation', // Location of subject in image |
|
116
|
|
|
0xa215: 'ExposureIndex', // Exposure index selected on camera |
|
117
|
|
|
0xa217: 'SensingMethod', // Image sensor type |
|
118
|
|
|
0xa300: 'FileSource', // Image source (3 == DSC) |
|
119
|
|
|
0xa301: 'SceneType', // Scene type (1 == directly photographed) |
|
120
|
|
|
0xa302: 'CFAPattern', // Color filter array geometric pattern |
|
121
|
|
|
0xa401: 'CustomRendered', // Special processing |
|
122
|
|
|
0xa402: 'ExposureMode', // Exposure mode |
|
123
|
|
|
0xa403: 'WhiteBalance', // 1 = auto white balance, 2 = manual |
|
124
|
|
|
0xa404: 'DigitalZoomRatio', // Digital zoom ratio |
|
125
|
|
|
0xa405: 'FocalLengthIn35mmFilm', |
|
126
|
|
|
0xa406: 'SceneCaptureType', // Type of scene |
|
127
|
|
|
0xa407: 'GainControl', // Degree of overall image gain adjustment |
|
128
|
|
|
0xa408: 'Contrast', // Direction of contrast processing applied by camera |
|
129
|
|
|
0xa409: 'Saturation', // Direction of saturation processing applied by camera |
|
130
|
|
|
0xa40a: 'Sharpness', // Direction of sharpness processing applied by camera |
|
131
|
|
|
0xa40b: 'DeviceSettingDescription', |
|
132
|
|
|
0xa40c: 'SubjectDistanceRange', // Distance to subject |
|
133
|
|
|
0xa420: 'ImageUniqueID', // Identifier assigned uniquely to each image |
|
134
|
|
|
0xa430: 'CameraOwnerName', |
|
135
|
|
|
0xa431: 'BodySerialNumber', |
|
136
|
|
|
0xa432: 'LensSpecification', |
|
137
|
|
|
0xa433: 'LensMake', |
|
138
|
|
|
0xa434: 'LensModel', |
|
139
|
|
|
0xa435: 'LensSerialNumber', |
|
140
|
|
|
// ============== |
|
141
|
|
|
// GPS Info tags: |
|
142
|
|
|
// ============== |
|
143
|
|
|
0x0000: 'GPSVersionID', |
|
144
|
|
|
0x0001: 'GPSLatitudeRef', |
|
145
|
|
|
0x0002: 'GPSLatitude', |
|
146
|
|
|
0x0003: 'GPSLongitudeRef', |
|
147
|
|
|
0x0004: 'GPSLongitude', |
|
148
|
|
|
0x0005: 'GPSAltitudeRef', |
|
149
|
|
|
0x0006: 'GPSAltitude', |
|
150
|
|
|
0x0007: 'GPSTimeStamp', |
|
151
|
|
|
0x0008: 'GPSSatellites', |
|
152
|
|
|
0x0009: 'GPSStatus', |
|
153
|
|
|
0x000a: 'GPSMeasureMode', |
|
154
|
|
|
0x000b: 'GPSDOP', |
|
155
|
|
|
0x000c: 'GPSSpeedRef', |
|
156
|
|
|
0x000d: 'GPSSpeed', |
|
157
|
|
|
0x000e: 'GPSTrackRef', |
|
158
|
|
|
0x000f: 'GPSTrack', |
|
159
|
|
|
0x0010: 'GPSImgDirectionRef', |
|
160
|
|
|
0x0011: 'GPSImgDirection', |
|
161
|
|
|
0x0012: 'GPSMapDatum', |
|
162
|
|
|
0x0013: 'GPSDestLatitudeRef', |
|
163
|
|
|
0x0014: 'GPSDestLatitude', |
|
164
|
|
|
0x0015: 'GPSDestLongitudeRef', |
|
165
|
|
|
0x0016: 'GPSDestLongitude', |
|
166
|
|
|
0x0017: 'GPSDestBearingRef', |
|
167
|
|
|
0x0018: 'GPSDestBearing', |
|
168
|
|
|
0x0019: 'GPSDestDistanceRef', |
|
169
|
|
|
0x001a: 'GPSDestDistance', |
|
170
|
|
|
0x001b: 'GPSProcessingMethod', |
|
171
|
|
|
0x001c: 'GPSAreaInformation', |
|
172
|
|
|
0x001d: 'GPSDateStamp', |
|
173
|
|
|
0x001e: 'GPSDifferential', |
|
174
|
|
|
0x001f: 'GPSHPositioningError' |
|
175
|
|
|
} |
|
176
|
|
|
|
|
177
|
|
|
loadImage.ExifMap.prototype.stringValues = { |
|
178
|
|
|
ExposureProgram: { |
|
179
|
|
|
0: 'Undefined', |
|
180
|
|
|
1: 'Manual', |
|
181
|
|
|
2: 'Normal program', |
|
182
|
|
|
3: 'Aperture priority', |
|
183
|
|
|
4: 'Shutter priority', |
|
184
|
|
|
5: 'Creative program', |
|
185
|
|
|
6: 'Action program', |
|
186
|
|
|
7: 'Portrait mode', |
|
187
|
|
|
8: 'Landscape mode' |
|
188
|
|
|
}, |
|
189
|
|
|
MeteringMode: { |
|
190
|
|
|
0: 'Unknown', |
|
191
|
|
|
1: 'Average', |
|
192
|
|
|
2: 'CenterWeightedAverage', |
|
193
|
|
|
3: 'Spot', |
|
194
|
|
|
4: 'MultiSpot', |
|
195
|
|
|
5: 'Pattern', |
|
196
|
|
|
6: 'Partial', |
|
197
|
|
|
255: 'Other' |
|
198
|
|
|
}, |
|
199
|
|
|
LightSource: { |
|
200
|
|
|
0: 'Unknown', |
|
201
|
|
|
1: 'Daylight', |
|
202
|
|
|
2: 'Fluorescent', |
|
203
|
|
|
3: 'Tungsten (incandescent light)', |
|
204
|
|
|
4: 'Flash', |
|
205
|
|
|
9: 'Fine weather', |
|
206
|
|
|
10: 'Cloudy weather', |
|
207
|
|
|
11: 'Shade', |
|
208
|
|
|
12: 'Daylight fluorescent (D 5700 - 7100K)', |
|
209
|
|
|
13: 'Day white fluorescent (N 4600 - 5400K)', |
|
210
|
|
|
14: 'Cool white fluorescent (W 3900 - 4500K)', |
|
211
|
|
|
15: 'White fluorescent (WW 3200 - 3700K)', |
|
212
|
|
|
17: 'Standard light A', |
|
213
|
|
|
18: 'Standard light B', |
|
214
|
|
|
19: 'Standard light C', |
|
215
|
|
|
20: 'D55', |
|
216
|
|
|
21: 'D65', |
|
217
|
|
|
22: 'D75', |
|
218
|
|
|
23: 'D50', |
|
219
|
|
|
24: 'ISO studio tungsten', |
|
220
|
|
|
255: 'Other' |
|
221
|
|
|
}, |
|
222
|
|
|
Flash: { |
|
223
|
|
|
0x0000: 'Flash did not fire', |
|
224
|
|
|
0x0001: 'Flash fired', |
|
225
|
|
|
0x0005: 'Strobe return light not detected', |
|
226
|
|
|
0x0007: 'Strobe return light detected', |
|
227
|
|
|
0x0009: 'Flash fired, compulsory flash mode', |
|
228
|
|
|
0x000d: 'Flash fired, compulsory flash mode, return light not detected', |
|
229
|
|
|
0x000f: 'Flash fired, compulsory flash mode, return light detected', |
|
230
|
|
|
0x0010: 'Flash did not fire, compulsory flash mode', |
|
231
|
|
|
0x0018: 'Flash did not fire, auto mode', |
|
232
|
|
|
0x0019: 'Flash fired, auto mode', |
|
233
|
|
|
0x001d: 'Flash fired, auto mode, return light not detected', |
|
234
|
|
|
0x001f: 'Flash fired, auto mode, return light detected', |
|
235
|
|
|
0x0020: 'No flash function', |
|
236
|
|
|
0x0041: 'Flash fired, red-eye reduction mode', |
|
237
|
|
|
0x0045: 'Flash fired, red-eye reduction mode, return light not detected', |
|
238
|
|
|
0x0047: 'Flash fired, red-eye reduction mode, return light detected', |
|
239
|
|
|
0x0049: 'Flash fired, compulsory flash mode, red-eye reduction mode', |
|
240
|
|
|
0x004d: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected', |
|
241
|
|
|
0x004f: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light detected', |
|
242
|
|
|
0x0059: 'Flash fired, auto mode, red-eye reduction mode', |
|
243
|
|
|
0x005d: 'Flash fired, auto mode, return light not detected, red-eye reduction mode', |
|
244
|
|
|
0x005f: 'Flash fired, auto mode, return light detected, red-eye reduction mode' |
|
245
|
|
|
}, |
|
246
|
|
|
SensingMethod: { |
|
247
|
|
|
1: 'Undefined', |
|
248
|
|
|
2: 'One-chip color area sensor', |
|
249
|
|
|
3: 'Two-chip color area sensor', |
|
250
|
|
|
4: 'Three-chip color area sensor', |
|
251
|
|
|
5: 'Color sequential area sensor', |
|
252
|
|
|
7: 'Trilinear sensor', |
|
253
|
|
|
8: 'Color sequential linear sensor' |
|
254
|
|
|
}, |
|
255
|
|
|
SceneCaptureType: { |
|
256
|
|
|
0: 'Standard', |
|
257
|
|
|
1: 'Landscape', |
|
258
|
|
|
2: 'Portrait', |
|
259
|
|
|
3: 'Night scene' |
|
260
|
|
|
}, |
|
261
|
|
|
SceneType: { |
|
262
|
|
|
1: 'Directly photographed' |
|
263
|
|
|
}, |
|
264
|
|
|
CustomRendered: { |
|
265
|
|
|
0: 'Normal process', |
|
266
|
|
|
1: 'Custom process' |
|
267
|
|
|
}, |
|
268
|
|
|
WhiteBalance: { |
|
269
|
|
|
0: 'Auto white balance', |
|
270
|
|
|
1: 'Manual white balance' |
|
271
|
|
|
}, |
|
272
|
|
|
GainControl: { |
|
273
|
|
|
0: 'None', |
|
274
|
|
|
1: 'Low gain up', |
|
275
|
|
|
2: 'High gain up', |
|
276
|
|
|
3: 'Low gain down', |
|
277
|
|
|
4: 'High gain down' |
|
278
|
|
|
}, |
|
279
|
|
|
Contrast: { |
|
280
|
|
|
0: 'Normal', |
|
281
|
|
|
1: 'Soft', |
|
282
|
|
|
2: 'Hard' |
|
283
|
|
|
}, |
|
284
|
|
|
Saturation: { |
|
285
|
|
|
0: 'Normal', |
|
286
|
|
|
1: 'Low saturation', |
|
287
|
|
|
2: 'High saturation' |
|
288
|
|
|
}, |
|
289
|
|
|
Sharpness: { |
|
290
|
|
|
0: 'Normal', |
|
291
|
|
|
1: 'Soft', |
|
292
|
|
|
2: 'Hard' |
|
293
|
|
|
}, |
|
294
|
|
|
SubjectDistanceRange: { |
|
295
|
|
|
0: 'Unknown', |
|
296
|
|
|
1: 'Macro', |
|
297
|
|
|
2: 'Close view', |
|
298
|
|
|
3: 'Distant view' |
|
299
|
|
|
}, |
|
300
|
|
|
FileSource: { |
|
301
|
|
|
3: 'DSC' |
|
302
|
|
|
}, |
|
303
|
|
|
ComponentsConfiguration: { |
|
304
|
|
|
0: '', |
|
305
|
|
|
1: 'Y', |
|
306
|
|
|
2: 'Cb', |
|
307
|
|
|
3: 'Cr', |
|
308
|
|
|
4: 'R', |
|
309
|
|
|
5: 'G', |
|
310
|
|
|
6: 'B' |
|
311
|
|
|
}, |
|
312
|
|
|
Orientation: { |
|
313
|
|
|
1: 'top-left', |
|
314
|
|
|
2: 'top-right', |
|
315
|
|
|
3: 'bottom-right', |
|
316
|
|
|
4: 'bottom-left', |
|
317
|
|
|
5: 'left-top', |
|
318
|
|
|
6: 'right-top', |
|
319
|
|
|
7: 'right-bottom', |
|
320
|
|
|
8: 'left-bottom' |
|
321
|
|
|
} |
|
322
|
|
|
} |
|
323
|
|
|
|
|
324
|
|
|
loadImage.ExifMap.prototype.getText = function (id) { |
|
325
|
|
|
var value = this.get(id) |
|
326
|
|
|
switch (id) { |
|
|
|
|
|
|
327
|
|
|
case 'LightSource': |
|
328
|
|
|
case 'Flash': |
|
329
|
|
|
case 'MeteringMode': |
|
330
|
|
|
case 'ExposureProgram': |
|
331
|
|
|
case 'SensingMethod': |
|
332
|
|
|
case 'SceneCaptureType': |
|
333
|
|
|
case 'SceneType': |
|
334
|
|
|
case 'CustomRendered': |
|
335
|
|
|
case 'WhiteBalance': |
|
336
|
|
|
case 'GainControl': |
|
337
|
|
|
case 'Contrast': |
|
338
|
|
|
case 'Saturation': |
|
339
|
|
|
case 'Sharpness': |
|
340
|
|
|
case 'SubjectDistanceRange': |
|
341
|
|
|
case 'FileSource': |
|
342
|
|
|
case 'Orientation': |
|
343
|
|
|
return this.stringValues[id][value] |
|
344
|
|
|
case 'ExifVersion': |
|
345
|
|
|
case 'FlashpixVersion': |
|
346
|
|
|
if (!value) return |
|
347
|
|
|
return String.fromCharCode(value[0], value[1], value[2], value[3]) |
|
348
|
|
|
case 'ComponentsConfiguration': |
|
349
|
|
|
if (!value) return |
|
350
|
|
|
return ( |
|
351
|
|
|
this.stringValues[id][value[0]] + |
|
352
|
|
|
this.stringValues[id][value[1]] + |
|
353
|
|
|
this.stringValues[id][value[2]] + |
|
354
|
|
|
this.stringValues[id][value[3]] |
|
355
|
|
|
) |
|
356
|
|
|
case 'GPSVersionID': |
|
357
|
|
|
if (!value) return |
|
358
|
|
|
return value[0] + '.' + value[1] + '.' + value[2] + '.' + value[3] |
|
359
|
|
|
} |
|
360
|
|
|
return String(value) |
|
361
|
|
|
} |
|
362
|
|
|
;(function (exifMapPrototype) { |
|
363
|
|
|
var tags = exifMapPrototype.tags |
|
364
|
|
|
var map = exifMapPrototype.map |
|
365
|
|
|
var prop |
|
366
|
|
|
// Map the tag names to tags: |
|
367
|
|
|
for (prop in tags) { |
|
368
|
|
|
if (tags.hasOwnProperty(prop)) { |
|
369
|
|
|
map[tags[prop]] = prop |
|
370
|
|
|
} |
|
371
|
|
|
} |
|
372
|
|
|
})(loadImage.ExifMap.prototype) |
|
373
|
|
|
|
|
374
|
|
|
loadImage.ExifMap.prototype.getAll = function () { |
|
375
|
|
|
var map = {} |
|
376
|
|
|
var prop |
|
377
|
|
|
var id |
|
378
|
|
|
for (prop in this) { |
|
379
|
|
|
if (this.hasOwnProperty(prop)) { |
|
380
|
|
|
id = this.tags[prop] |
|
381
|
|
|
if (id) { |
|
382
|
|
|
map[id] = this.getText(id) |
|
383
|
|
|
} |
|
384
|
|
|
} |
|
385
|
|
|
} |
|
386
|
|
|
return map |
|
387
|
|
|
} |
|
388
|
|
|
}) |
|
389
|
|
|
|